package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.AlertData;
import com.zzyl.entity.User;
import com.zzyl.vo.AlertDataVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface AlertDataMapper {
    int deleteByPrimaryKey(Long id);

    int insert(AlertData record);

    int insertSelective(AlertData record);

    AlertData selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AlertData record);

    int updateByPrimaryKey(AlertData record);

    /**
     * 这是Mybatis Generator拓展插件生成的方法(请勿删除).
     * This method corresponds to the database table alert_data
     *
     * @mbg.generated
     * @author hewei
     */
    int batchInsert(@Param("list") List<AlertData> list);

    /**
     * 分页查询报警数据
     * @param deviceName
     * @param id
     * @param startDate
     * @param endDate
     * @param status
     * @return
     */
    Page<AlertDataVo> pageQuery(@Param("deviceName") String deviceName,
                                @Param("id") Long id,
                                @Param("startDate") LocalDateTime startDate,
                                @Param("endDate") LocalDateTime endDate,
                                @Param("status") Integer status);

    @Select("select * from alert_data where id = #{id}")
    AlertData selectById(Long id);

    @Update("UPDATE alert_data SET status = 1")
    void updateById(Long id);

}